package com.zhao.dota.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhao.dota.model.Permission;
import com.zhao.dota.model.Role;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface PermissionMapper extends BaseMapper<Permission> {

    @Select("select a.* from permission a " +
            "  left join role_permission b " +
            "    on a.id = b.permission_id " +
            " where b.role_id = #{roleId}")
    List<Permission> findByRole(Integer roleId);

}
